package com.scan.utils;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.scan.service.RedisService;

/**
 * Created by tancw on 2017/2/17.
 */
@Component
public class CacheUtil {

    private static RedisService service;

    @Resource
    private RedisService redisService;

    @PostConstruct
    public void init() {
        service = this.redisService;
    }

    public static boolean add(String key, Object value, long expire) {
        return service.set(key, value, expire);
    }

    public static Object get(String key) {
        return service.get(key);
    }
}
